package cn.yuanqiao.archive.management.domain;

import cn.yuanqiao.common.annotation.Excel;
import cn.yuanqiao.common.exception.ServiceException;
import cn.yuanqiao.common.utils.StringUtils;
import cn.yuanqiao.common.core.domain.BaseEntity;
import cn.yuanqiao.common.utils.SecurityUtils;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.util.Date;

/**
 * 组盘规则对象 YQZPGZ
 * 
 * @author sy
 * @date 2023-07-10
 */
public class YqZpgz extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    private final String BIGTABLENAME = "_YQZPGZ";

    public YqZpgz() {
        String userCode = SecurityUtils.getTenantCode();
        if(StringUtils.isEmpty(userCode)){
            throw new ServiceException("TenantCode is null");
//            this.tableName = "YQZPGZ";
        }else {
            this.tableName = userCode.toUpperCase()+BIGTABLENAME;
//            this.tableName = "YQZPGZ";
        }
    }

    private String tableName;

    public String getTableName() {
        return tableName;
    }

    public void setTableName(String tableName) {
        this.tableName = tableName;
    }

    /** 组盘规则ID */
//    @IdAnnotation
    private Long zpgzId;

    /** 盘规格ID */
    @Excel(name = "盘规格ID")
    private Long pggId;

    /** 门类ID */
    @Excel(name = "门类ID")
    private Long categoryId;

    /** 门类名称 */
    @Excel(name = "门类名称")
    private String categoryName;

    /** 开始时间 */
    @Excel(name = "开始时间")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private String startTime;

    /** 结束时间 */
    @Excel(name = "结束时间")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private String endTime;

    /** 全宗代码 */
    @Excel(name = "全宗代码")
    private String fondsCode;

    /** 全宗名称 */
    @Excel(name = "全宗名称")
    private String fondsName;

    /** 保管期限 */
    @Excel(name = "保管期限")
    private String bgqx;

    /** 密级 */
    @Excel(name = "密级")
    private String mj;

    /** 是否已用 */
    @Excel(name = "是否已用")
    private Integer isUse;

    /** 创建人 */
    @Excel(name = "创建人")
    private Long creatorId;

    /** 创建时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date createTime;

    /** 最后修改人 */
    @Excel(name = "最后修改人")
    private Long lastupdater;

    /** 最后修改时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "最后修改时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date lastupdateTime;

    /** 是否删除 */
    @Excel(name = "是否删除")
    private Integer isDel;

    /** 组盘状态 */
    private Integer state;

    public void setZpgzId(Long zpgzId) 
    {
        this.zpgzId = zpgzId;
    }

    public Long getZpgzId() 
    {
        return zpgzId;
    }
    public void setPggId(Long pggId) 
    {
        this.pggId = pggId;
    }

    public Long getPggId() 
    {
        return pggId;
    }
    public void setCategoryId(Long categoryId) 
    {
        this.categoryId = categoryId;
    }

    public Long getCategoryId() 
    {
        return categoryId;
    }
    public void setCategoryName(String categoryName) 
    {
        this.categoryName = categoryName;
    }

    public String getCategoryName() 
    {
        return categoryName;
    }
    public void setStartTime(String startTime) 
    {
        this.startTime = startTime;
    }

    public String getStartTime() 
    {
        return startTime;
    }
    public void setEndTime(String endTime) 
    {
        this.endTime = endTime;
    }

    public String getEndTime() 
    {
        return endTime;
    }
    public void setFondsCode(String fondsCode) 
    {
        this.fondsCode = fondsCode;
    }

    public String getFondsCode() 
    {
        return fondsCode;
    }
    public void setFondsName(String fondsName) 
    {
        this.fondsName = fondsName;
    }

    public String getFondsName() 
    {
        return fondsName;
    }
    public void setBgqx(String bgqx)
    {
        this.bgqx = bgqx;
    }

    public String getBgqx()
    {
        return bgqx;
    }
    public void setMj(String mj)
    {
        this.mj = mj;
    }

    public String getMj()
    {
        return mj;
    }
    public void setIsUse(Integer isUse) 
    {
        this.isUse = isUse;
    }

    public Integer getIsUse() 
    {
        return isUse;
    }
    public void setCreatorId(Long creatorId) 
    {
        this.creatorId = creatorId;
    }

    public Long getCreatorId() 
    {
        return creatorId;
    }

    @Override
    public Date getCreateTime() {
        return createTime;
    }

    @Override
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public void setLastupdater(Long lastupdater)
    {
        this.lastupdater = lastupdater;
    }

    public Long getLastupdater() 
    {
        return lastupdater;
    }
    public void setLastupdateTime(Date lastupdateTime) 
    {
        this.lastupdateTime = lastupdateTime;
    }

    public Date getLastupdateTime() 
    {
        return lastupdateTime;
    }
    public void setIsDel(Integer isDel) 
    {
        this.isDel = isDel;
    }

    public Integer getIsDel() 
    {
        return isDel;
    }

    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("zpgzId", getZpgzId())
            .append("pggId", getPggId())
            .append("categoryId", getCategoryId())
            .append("categoryName", getCategoryName())
            .append("startTime", getStartTime())
            .append("endTime", getEndTime())
            .append("fondsCode", getFondsCode())
            .append("fondsName", getFondsName())
            .append("bgqx", getBgqx())
            .append("mj", getMj())
            .append("isUse", getIsUse())
            .append("creatorId", getCreatorId())
            .append("createTime", getCreateTime())
            .append("lastupdater", getLastupdater())
            .append("lastupdateTime", getLastupdateTime())
            .append("isDel", getIsDel())
            .toString();
    }
}
